#########################
#   Author : Leon yu    #
#   Date : 2025/06/03   #
#   Id : SM2772         #
#########################
from datetime import datetime
from util import Utils, currentPath
from dbResps import timestamp2Data

# apiEnv = "onl"
# apiRegion = "cn1"
# bussinessName = "Gpos"


currentDatetime = datetime.now()
currentDate = str(currentDatetime.year) + str(currentDatetime.month).zfill(2) + str(currentDatetime.day).zfill(2)

# Utils(bussinessName=bussinessName)
userInfo = Utils.login2Cloud()
apiInitData = {
    "userInfo" : Utils.login2Cloud(),
    "userId" : userInfo['userId'],
    "refreshToken" : userInfo['refreshToken'],
    "accessToken" : Utils.getAccessToken(userInfo['refreshToken']),
    "apisInfo" : Utils.apisInfo,
    "apisUri" : Utils.template(Utils.commonHost, {"region" : Utils.apiRegion})
}
commonReqFunc = Utils.commonReqFunc
apiInitDataPath = f"apiInitData/apiInitData_{currentDate}.json"
Utils.writeData(apiInitData, apiInitDataPath, True)
timestamp2Data = timestamp2Data

orgId = Utils.orgId
businessEnv = Utils.businessEnv
isNowDate = Utils.isNowDate
